package priv.pront.code.robot.roboCom_uni;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-06-29 14:03
 */
public class NOIP2014_提高组_生活大爆炸版石头剪刀布 {
    static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

    static int n, m, k, cntA = 0, cntB = 0;
    static int[] a, b;

    public static void main(String[] args) throws IOException {
        st.nextToken();
        n = (int) st.nval;
        st.nextToken();
        m = (int) st.nval;
        st.nextToken();
        k = (int) st.nval;

        a = new int[m];
        b = new int[k];

        for (int i = 0; i < m; i++) {
            st.nextToken();
            a[i] = (int) st.nval;
        }

        for (int i = 0; i < k; i++) {
            st.nextToken();
            b[i] = (int) st.nval;
        }

        //0 表示“剪刀”，
        //1
        //1 表示“石头”，
        //2
        //2 表示“布”，
        //3
        //3 表示“蜥蜴人”，
        //4
        //4表示“斯波克
        int ida = 0, idb = 0;
        for (int i = 0; i < n; i++, ida++, idb++) {
            if(ida == a.length){
                ida = 0;
            }
            if (idb == b.length) {
                idb = 0;
            }
            int scoreA = a[ida];
            int scoreB = b[idb];
            if (scoreA == scoreB) continue;
            if(a[ida]==0&&b[idb]==1)cntB++;
            if(a[ida]==0&&b[idb]==2)cntA++;
            if(a[ida]==0&&b[idb]==3)cntA++;
            if(a[ida]==0&&b[idb]==4)cntB++;
            if(a[ida]==1&&b[idb]==0)cntA++;
            if(a[ida]==1&&b[idb]==2)cntB++;
            if(a[ida]==1&&b[idb]==3)cntA++;
            if(a[ida]==1&&b[idb]==4)cntB++;
            if(a[ida]==2&&b[idb]==0)cntB++;
            if(a[ida]==2&&b[idb]==1)cntA++;
            if(a[ida]==2&&b[idb]==3)cntB++;
            if(a[ida]==2&&b[idb]==4)cntA++;
            if(a[ida]==3&&b[idb]==0)cntB++;
            if(a[ida]==3&&b[idb]==1)cntB++;
            if(a[ida]==3&&b[idb]==2)cntA++;
            if(a[ida]==3&&b[idb]==4)cntA++;
            if(a[ida]==4&&b[idb]==0)cntA++;
            if(a[ida]==4&&b[idb]==1)cntA++;
            if(a[ida]==4&&b[idb]==2)cntB++;
            if(a[ida]==4&&b[idb]==3)cntB++;
        }
        System.out.println(cntA + " " + cntB);
    }
}
